package com.fuxue.service.impl;

import com.fuxue.dto.LikeDTO;
import com.fuxue.entity.Like;
import com.fuxue.mapper.LikeMapper;
import com.fuxue.service.LikeService;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;

@Service
public class LikeServiceImpl implements LikeService {

    @Autowired
    private LikeMapper likeMapper;

    @Override
    @Transactional
    public void Insert(LikeDTO likeDTO) {
        likeDTO.setTime(LocalDateTime.now());
        likeMapper.AddLike(likeDTO);
        likeMapper.addPoint(likeDTO.getServerId());
    }
}
